package ycl.common.utils;

import cn.hutool.core.util.StrUtil;

/**
 * 正则
 *
 * @author ycl
 * @date 2022/6/26 0026 0:54:51
 */
public class RegularUtil {


	public static boolean idCard(String idCard) {
		if (StrUtil.isBlank(idCard) || idCard.length() != 18)
			return false;
		String regular = "(^[0-9]{6}(19[0-9][0-9]|20[0-2][0-9])(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])[0-9]{3}[0-9X]$)";
		boolean matches = idCard.matches(regular);
		if (!matches)
			return false;

		return true;
	}

}
